package fun.xinnix.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class DirectConfig {
    @Bean
    public DirectExchange directExchange() {
        return ExchangeBuilder.directExchange("demo.direct").build();
    }

    @Bean(name = "directQueue")
    public Queue directQueue() {
        return QueueBuilder.durable("demo.direct.queue").build();
    }

    @Bean(name = "directBinding")
    public Binding directBinding(@Qualifier("directQueue") Queue queue, DirectExchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with("red");
    }
}
